package comTest;

import com.dao.WebDao;
import com.service.WebService;
import com.service.WebServiceImpl;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
 * Created by 黑旋风诸葛亮 on 2018/1/30.
 */
public class WebTest extends AbstractApplicationContext {

    @Autowired
    private WebDao webDao;

    @Before
    public void setUp() throws Exception {


    }

    @Override
    protected void refreshBeanFactory() throws BeansException, IllegalStateException {

    }

    @Override
    protected void closeBeanFactory() {

    }

    @Override
    public ConfigurableListableBeanFactory getBeanFactory() throws IllegalStateException {
        return null;
    }

    @Test
    public void wetTest()  {


      //  String xmlPath = "E:\\testjei\\demo0130\\web\\WEB-INF\\applicationContext.xml";
       // String xmlPath = "E:/testjei/demo0130/web/WEB-INF/applicationContext.xml";
        String xmlPath = "src/resource/applicationContext.xml";
        ApplicationContext context = new FileSystemXmlApplicationContext(xmlPath);
        WebServiceImpl us = (WebServiceImpl) context.getBean("WebService");

     //   webDao.getMessage();

        us.message();
    }



}
